﻿using Infrastructure;
using OpenAuth.Mvc.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OpenAuth.Mvc.Controllers
{
    public class SendMailController : BaseController
    {
        // GET: Signet
        public ActionResult Index()
        {
            return View();
        }


        [HttpPost]
        [HandlerAjaxOnly]
        [ValidateAntiForgeryToken]
        [ValidateInput(false)]
        public ActionResult SendMail(string account, string title, string content)
        {
            MailHelper mail = new MailHelper();
            mail.MailServer = ConfigurationManager.AppSettings["MailHost"];
            mail.MailUserName = ConfigurationManager.AppSettings["MailUserName"];
            mail.MailPassword = ConfigurationManager.AppSettings["MailPassword"];
            mail.MailName = "NFine快速开发平台";
            mail.Send(account, title, content);
            return Content("发送成功。");
        }
    }
}